/**
 * 
 */
package com.thor.palmmall.rest.statement.converter;

import java.util.ArrayList;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.statement.AFloorsParam;
import com.thor.palmmall.spi.basic.SFloorsParam;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SFloorsParamConverter implements Converter<AFloorsParam, SFloorsParam> {

  public static SFloorsParamConverter getInstance() {
    if (instance == null)
      instance = new SFloorsParamConverter();
    return instance;
  }

  private static SFloorsParamConverter instance;

  private SFloorsParamConverter() {
  }

  @Override
  public SFloorsParam convert(AFloorsParam source) {
    if (source == null) {
      return null;
    }
    SFloorsParam target = new SFloorsParam();
    target.setBuilding(UCN.newInstance(source.getBuilding()));
    target.setStores(new ArrayList<String>());
    target.getStores().addAll(source.getStores());
    return target;
  }

}
